package cn.net.cfss.fgbp.provider.console.biz;

import cn.net.cfss.fgbp.api.console.dto.SysUserRoleDto;
import cn.net.cfss.fgbp.api.console.vo.SysUserRoleVo;
import cn.net.cfss.fgbp.base.common.biz.BaseBiz;
import cn.net.cfss.fgbp.provider.console.dao.SysUserRoleDtoMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserRoleDtoBiz extends BaseBiz<SysUserRoleDtoMapper, SysUserRoleDto> {

    /**
     * 批量插入用户角色
     *
     * @param sysUserRoleDtoList
     * @return
     */
    public int insertBatch(List<SysUserRoleDto> sysUserRoleDtoList) {
        return mapper.insertBatch(sysUserRoleDtoList);
    }

    /**
     * 根据用户ID删除
     *
     * @param userId
     * @return
     */
    public int deleteByUserId(Long userId) {
        return mapper.deleteByUserId(userId);
    }

    /**
     * 根据用户ID批量删除
     *
     * @param userIds
     * @return
     */
    public int deleteBatchByUserId(List<Long> userIds) {
        return mapper.deleteBatchByUserId(userIds);
    }

    /**
     * 根据用户ID查询角色信息
     * 
     * @param userId
     * @return
     */
    public List<SysUserRoleVo> getRoleListByUserId(Long userId) {
        return mapper.getRoleListByUserId(userId);
    }

    public List<String> getRoleCodeByUid(Long userId) {
        return mapper.getRoleCodeByUid(userId);
    }
}
